/**
 * Project Name:九色鹿
 * File Name:RandomNameCreator.java
 * Package Name:com.fxp.project.jiuselu.commons.name.util
 * Date:2020年04月06日 11:44
 * Copyright (c) 2020, Jason.Wang All Rights Reserved.
 */
package com.fxp.project.jiuselu.commons.name.util;

import com.fxp.project.jiuselu.commons.name.IRandomName;
import com.fxp.project.jiuselu.commons.name.IRandomNameFactory;
import lombok.extern.log4j.Log4j2;

/**
 * ClassName:RandomNameCreator<br/>
 * Function: 姓名创建工具<br/>
 * Date:2020年04月06日 11:44<br/>
 *
 * @author Jason.Wang
 * @version 1.0.0.0
 * @see
 * @since JDK1.8
 */
@Log4j2
public class RandomNameCreator implements IRandomNameFactory {
    /**
     * factory: 创建一个产品对象，其输入参数类型可以自行设置<br/>
     *
     * @param clazz
     * @return
     * @author Jason.Wang
     * @createTime 2020/4/6 11:43
     */
    @Override
    public <T extends IRandomName> T factory(Class<T> clazz) {
        T randomName = null;
        try {
            randomName = (T) Class.forName(clazz.getName()).getDeclaredConstructor().newInstance();
        } catch (Exception e) {
            log.warn(">>>" + e);
        }
        return randomName;
    }
}
